class Stock:
    def __init__(self, code, name, price, industry_name):
        self.code = code          # 股票代码
        self.name = name          # 股票名称
        self.price = price        # 股票价格
        self.industry_name = industry_name  # 所属行业
    
    def to_dict(self):
        return {
            'code': self.code,
            'name': self.name,
            'price': self.price,
            'industry': self.industry_name
        }

class Industry:
    def __init__(self, name):
        self.name = name          # 行业名称
        self.stocks = []          # 该行业的股票列表
    
    def add_stock(self, stock):
        self.stocks.append(stock)
    
    def get_stock_count(self):
        return len(self.stocks)
    
    def to_dict(self):
        return {
            'name': self.name,
            'stock_count': len(self.stocks),
            'stocks': [stock.to_dict() for stock in self.stocks]
        }